import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:gallery/compent_page.dart';

class EnvironmentConfig {
  static const IS_RUN_ALONE =
      bool.fromEnvironment('IS_RUN_ALONE', defaultValue: false);
}

class Galleria extends StatelessWidget {
  final String? titles;
  final Function()? onJump;
  const Galleria({this.titles, this.onJump});
  
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Image.asset(EnvironmentConfig.IS_RUN_ALONE ? "packages/gallery/assets/app_current.png" : "assets/app_current.png"),
        Container(
          height: 100,
          child: ListView.builder(
            itemCount: 10,
            itemBuilder: (context, index) => Text(titles ?? "Galleria")
          ),
        ),
        IconButton(onPressed: onJump, icon: Text("Jump page")),
        IconButton(onPressed: () => Navigator.push(context, CupertinoPageRoute(builder: (_) => CompentPage())), icon: Text("Jump component"))
      ],
    );
  }
}
